﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="open.aspx.cs" Inherits="referrals.Layouts.referrals.Open" DynamicMasterPageFile="~masterurl/default.master" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <link href="../1033/STYLES/referrals/referralsmaster.css" rel="stylesheet" />
</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <asp:Label runat="server"><h1>Referrals Management System</h1></asp:Label>
    <table style="width: 100%;">
        <tr>
            <td>
                <label>Search by Name</label>
                <br />
                <asp:TextBox runat="server" ID="txtNameSearch"></asp:TextBox></td>
            <td>
                <label>New Referrals</label><br />
                <input id="Button3" type="button" value="Risk Assessment" onclick="window.location = 'NewReferralsRiskAssessment.aspx'" /></td>
            <td>
                <label>Active Referrals</label><br />
                <input id="Button8" type="button" value="Risk Assessments" /></td>
            <td>
                <label>InPatients</label><br />
                <input id="Button13" type="button" value="MS/LS Inpatient Indo" /></td>
        </tr>
        <tr>
            <td>
                <label>Search by NHS Number</label><br />
                <asp:TextBox runat="server" ID="txtNHSNumber"></asp:TextBox><asp:Label runat="server" Text="(xxx xxx xxxx)"></asp:Label></td>
            <td>
                <input id="Button4" type="button" value="Admission requests" onclick="window.location = 'NewReferralsAdmissionRequests.aspx'" /></td>
            <td>
                <input id="Button9" type="button" value="Admission requests" /></td>
            <td>
                <input id="Button14" type="button" value="MS/LS bed State" /></td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="btnSearch" runat="server" Text="Find" OnClick="btnSearch_Click" /></td>
            <td>
                <input id="Button5" type="button" value="Court Reports" onclick="window.location = 'NewReferralsCourtReports.aspx'" /></td>
            <td>
                <input id="Button10" type="button" value="Court Reports" /></td>
            <td>
                <input id="Button15" type="button" value="LD Inpatient info" /></td>
        </tr>
        <tr>
            <td>
                <asp:Button runat="server" ID="btnClear" Text="Clear" OnClick="btnClear_Click" /></td>
            <td>
                <input id="Button6" type="button" value="Other Reports" onclick="window.location = 'NewReferralsOtherReports.aspx'" /></td>
            <td>
                <input id="Button11" type="button" value="Other Reports" /></td>
            <td>
                <input id="Button16" type="button" value="LD Bed State" /></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>
                <input id="Button7" type="button" value="CPA Requests" onclick="window.location = 'NewReferralsCPARequests.aspx'" /></td>
            <td>
                <input id="Button12" type="button" value="CPA Requests" /></td>
            <td>
                <input id="Button17" type="button" value="Admit" disabled="disabled" /></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>
                <input id="Button1" type="button" value="Access Assessment" onclick="window.location = 'NewReferralsAccessAssessment.aspx'" /></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
    </table>
    <p>&nbsp;</p>
    <table style="width: 100%;">
        <tr>
            <td colspan="4" style="text-align: center">----------------------------------------
                <label>Administration</label>
                ----------------------------------------</td>
            <td colspan="2" style="text-align: center">---------------
                <label>Information</label>
                ---------------</td>

        </tr>
        <tr>
            <td>
                <input id="Button18" type="button" value="Add Another Referral" disabled="disabled" /></td>
            <td>
                <input id="Button19" type="button" value="Add Staff" /></td>
            <td>
                <input id="Button20" type="button" value="Manage Waiting List" /></td>
            <td>
                <input id="Button21" type="button" value="View All Referrals" /></td>
            <td>
                <input id="Button22" type="button" value="Reports Due" /></td>
            <td>
                <input id="Button23" type="button" value="KPI Information" /></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
    </table>
    <asp:Panel runat="server" ID="Panel1">
        <asp:GridView runat="server" ID="gridView1">
        </asp:GridView>
        <asp:GridView runat="server" ID="gridView2" AutoGenerateColumns="false" ShowHeader="False">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Label runat="server" Text='<%# String.Format("{0} {1} {2} {3} {4}", "Name: ", Eval("Title"), Eval("MiddleName"), Eval("FirstName"), Eval("LastName")) %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# String.Format("{0} {1}", "NHS Number: ", Eval("NHSNumber")) %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="DOB" HeaderText="Date of Birth: " HtmlEncode="false" DataFormatString="D.O.B. {0:dd/MM/yy}" />
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Label ID="lblDate" runat="server" Text='<%# GetAge(Convert.ToDateTime(Eval("DOB"))) %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Label ID="lblDate" runat="server" Text='<%# Eval("Gender") %>' Visible="False" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:GridView runat="server" ID="gridView3" AutoGenerateColumns="False" ShowHeader="False" GridLines="None" OnRowDataBound="OnRowDataBound" OnPageIndexChanging="gridView3_PageIndexChanging" AllowPaging="True" PageSize="1">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <table>
                            <tr>
                                <td style="border: solid black 1px"><label>Referral Details</label>
                                    <asp:Label ID="lblCpaStage" runat="server" Text='<%# Eval("Type") %>' Visible="false" /><asp:DropDownList runat="server" ID="ddlCpaStage" /></td>
                                <td style="border: solid black 1px"><label>Discussion</label><br />
                                    <asp:TextBox runat="server" TextMode="MultiLine" Text='<%# Eval("RefDiscussion") %>'></asp:TextBox></td>
                                <td style="border: solid black 1px"><label>Allocated To</label>
                                    <asp:Label ID="lblContactBy1" runat="server" Text='<%# Eval("ContactBy1") %>' Visible="false" /><asp:DropDownList runat="server" ID="ddlContactBy1" /></td>
                                <td style="border: solid black 1px"><label>Assessed</label>
                                    <asp:Label ID="lblAssessmentDate" runat="server" Text='<%# Eval("AssessmentDate") %>' Visible="false" /><asp:TextBox runat="server" ID="txtAssessmentDate" Text=''></asp:TextBox></td>
                            </tr>
                            <tr>
                                <td style="border: solid black 1px">
                                    <asp:Label runat="server">Date Referred: </asp:Label><asp:Label ID="lblUrgency" Visible="False" runat="server" Text='<%# Eval("Urgency") %>' /><asp:Label ID="lblDateReferred" Visible="False" runat="server" Text='<%# Eval("DateReferred") %>' /><asp:TextBox runat="server" Text='' ID="txtDateReferred"></asp:TextBox><asp:DropDownList runat="server" ID="ddlUrgency" /></td>
                                <td style="border: solid black 1px">&nbsp;</td>
                                <td style="border: solid black 1px">
                                    <asp:Label ID="lblContactBy2" runat="server" Text='<%# Eval("ContactBy2") %>' Visible="false" /><asp:DropDownList ID="ddlContactBy2" runat="server" /></td>
                                <td style="border: solid black 1px"><label>Papers Located</label>
                                    <asp:TextBox runat="server" ID="txtPapersLocation" Text='<%# Eval("PapersLocation") %>'></asp:TextBox></td>
                            </tr>
                            <tr>
                                <td style="border: solid black 1px">
                                    <asp:Label runat="server">Refered By: </asp:Label><asp:Label ID="lblReferredBy" Visible="False" runat="server" Text='<%# Eval("ReferredBy") %>' /><asp:DropDownList runat="server" ID="ddlReferredBy" /></td>
                                <td style="border: solid black 1px"><label>Initial Outcome</label>
                                    <asp:Label ID="lblInitialOutcome" Visible="False" runat="server" Text='<%# Eval("RefOutcome") %>' /><asp:DropDownList runat="server" ID="ddlInitialOutcome" /></td>
                                <td style="border: solid black 1px"><label>Response Sent</label>
                                    <asp:Label ID="lblreferralResponse" Visible="False" runat="server" Text='<%# Eval("referralResponse") %>' /><asp:TextBox runat="server" ID="txtResponseSent" Text=''></asp:TextBox></td>
                                <td style="border: solid black 1px"><label>Report Sent</label>
                                    <asp:Label ID="lblReportSent" Visible="False" runat="server" Text='<%# Eval("ReportSent") %>' /><asp:TextBox runat="server" ID="txtReportSent" Text=''></asp:TextBox></td>
                            </tr>
                            <tr>
                                <td style="border: solid black 1px">
                                    <asp:Label runat="server">Reason Referred: </asp:Label><asp:Label ID="lblReasons" runat="server" Text='<%# Eval("ReasonReferred") %>' Visible="false" /><asp:DropDownList runat="server" ID="ddlReasons" /></td>
                                <td style="border: solid black 1px">&nbsp;</td>
                                <td style="border: solid black 1px">
                                    <label>Closed</label><asp:Label ID="lblStatus" runat="server" Text='<%# Eval("Closed") %>' Visible="false" /><asp:CheckBox runat="server" ID="chkStatus" /></td>
                                <td style="border: solid black 1px">&nbsp;</td>
                                <tr>
                                    <td style="border: solid black 1px">
                                        <asp:TextBox runat="server" TextMode="MultiLine" ID="txtDescription" Width="370px" Text='<%# Eval("Description") %>'></asp:TextBox></td>
                                    <td style="border: solid black 1px"><label>Final Outcome</label>
                                        <asp:Label ID="lblFinalOutcome" Visible="False" runat="server" Text='<%# Eval("FOutcome") %>' /><asp:DropDownList runat="server" ID="ddlFinalOutcome" /></td>
                                    <td style="border: solid black 1px">&nbsp;</td>
                                    <td style="border: solid black 1px">&nbsp;</td>
                                </tr>
                            </tr>
                        </table>
                    </ItemTemplate>

                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </asp:Panel>
    <asp:Label runat="server" ID="lblNoSearchResults"></asp:Label>
</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    Referrals Management System
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">
    Referrals Management System
</asp:Content>
